
package com.lht.admin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lht.admin.annotation.SysLog;
import com.lht.admin.utils.R;
import com.lht.admin.controller.AbstractController;
import com.lht.admin.entity.LoanApplyReplaceUserLogEntity;
import com.lht.admin.service.LoanApplyReplaceUserLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 申请资料更换业务员记录表Controller
 *
 * @author ZhengZhanWu
 * @date 2020-02-16 20:26:11
 */
@RestController
@RequestMapping("/loanapplyreplaceuserlog")
public class LoanApplyReplaceUserLogController extends AbstractController {
    @Autowired
    private LoanApplyReplaceUserLogService loanApplyReplaceUserLogService;

    /**
     * 查看所有列表
     *
     * @param params 查询参数
     * @return R
     */
    @RequestMapping("/queryAll")
    @RequiresPermissions("loanapplyreplaceuserlog:list")
    public R queryAll(@RequestParam Map<String, Object> params) {
        List<LoanApplyReplaceUserLogEntity> list = loanApplyReplaceUserLogService.queryAll(params);

        return R.ok().put("list", list);
    }

    /**
     * 分页查询申请资料更换业务员记录表
     *
     * @param params 查询参数
     * @return R
     */
    @GetMapping("/list")
    @RequiresPermissions("loanapplyreplaceuserlog:list")
    public R list(@RequestParam Map<String, Object> params) {
        Page page = loanApplyReplaceUserLogService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 根据主键查询详情
     *
     * @param id 主键
     * @return R
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("loanapplyreplaceuserlog:info")
    public R info(@PathVariable("id") Long id) {
        LoanApplyReplaceUserLogEntity loanApplyReplaceUserLog = loanApplyReplaceUserLogService.getById(id);

        return R.ok().put("loanapplyreplaceuserlog", loanApplyReplaceUserLog);
    }

    /**
     * 新增申请资料更换业务员记录表
     *
     * @param loanApplyReplaceUserLog loanApplyReplaceUserLog
     * @return R
     */
    @SysLog("新增申请资料更换业务员记录表")
    @RequestMapping("/save")
    @RequiresPermissions("loanapplyreplaceuserlog:save")
    public R save(@RequestBody LoanApplyReplaceUserLogEntity loanApplyReplaceUserLog) {

        loanApplyReplaceUserLogService.add(loanApplyReplaceUserLog);

        return R.ok();
    }

    /**
     * 修改申请资料更换业务员记录表
     *
     * @param loanApplyReplaceUserLog loanApplyReplaceUserLog
     * @return R
     */
    @SysLog("修改申请资料更换业务员记录表")
    @RequestMapping("/update")
    @RequiresPermissions("loanapplyreplaceuserlog:update")
    public R update(@RequestBody LoanApplyReplaceUserLogEntity loanApplyReplaceUserLog) {

        loanApplyReplaceUserLogService.update(loanApplyReplaceUserLog);

        return R.ok();
    }

    /**
     * 根据主键删除申请资料更换业务员记录表
     *
     * @param ids ids
     * @return R
     */
    @SysLog("删除申请资料更换业务员记录表")
    @RequestMapping("/delete")
    @RequiresPermissions("loanapplyreplaceuserlog:delete")
    public R delete(@RequestBody Long[] ids) {
        loanApplyReplaceUserLogService.deleteBatch(ids);

        return R.ok();
    }
}
